<%@ page language="java" pageEncoding="UTF-8"%><%@ include
	file="/WEB-INF/commons/taglibs.jsp"%>
<link type="text/css" rel="stylesheet"
	href="<c:url value="/css/jquery.confirm.css" />" />
<script type="text/javascript"
	src="<c:url value="/js/jquery.confirm.js" />"></script>
<script type="text/javascript">
$(function(){
	$('#topic').focus();
	$('#btnDel').click(function(){
		$.confirm({
			'title':'Delete Confirmation','message':'Are you sure?',
			'buttons':{
				'Yes':{'class':'blue','action':function(){window.location.href='/problem/delete?id='+$('#id').val();}},
				'No':{'class':'gray','action':function(){}}
			}
		});
	});
	$('#btnCancel').click(function(){
		var url=window.location.href;
		var index=url.indexOf('&back=');
		if(index==-1){window.location.href='/index';}
		else{url=url.substring(index+6);if(url=='null'){window.location.href='/index';}else{window.location.href='/search?'+url;}}
	});
});
</script>
<form name="problemForm" method="POST"
	action="<c:url value="/problem/save" />" class="problemForm">
<fieldset><legend><c:choose>
	<c:when test="${empty it}">Create Problem</c:when>
	<c:otherwise>Edit Problem</c:otherwise>
</c:choose></legend> <input type="hidden" id="id" name="id"
	<c:choose><c:when test="${empty it}">value="0"</c:when><c:otherwise>value="${it.id}"</c:otherwise></c:choose> /><label
	for="topics">Topics: <br />
<input type="text" id="topics" name="topics" value="${it.topics}"
	class="txt" /></label><br />
<label for="problem">Problem: <br />
<textarea id="problem" name="problem" class="txtarea">${it.problem.value}</textarea></label><br />
<label for="solution">Solution: <br />
<textarea id="solution" name="solution" class="txtarea">${it.solution.value}</textarea></label><br />
<label for="source">Source: <br />
<input type="text" id="source" name="source" value="${it.source}"
	class="txt" /></label><br />
<label for="difficulty">Difficulty: <br />
<input type="text" id="difficulty" name="difficulty"
	<c:choose><c:when test="${empty it}">value="0.0"</c:when><c:otherwise>value="${it.difficulty}"</c:otherwise></c:choose>
	class="txt" /></label><br />
<label for="note">Note: <br />
<textarea id="note" name="note" class="txtarea">${it.note.value}</textarea></label><br />
<input type="submit" value="Save" />&nbsp;<input id="btnDel"
	type="button" value="Delete" />&nbsp;<input id="btnCancel"
	type="button" value="Cancel" /><c:if test="${not empty it}">
</c:if></fieldset>
</form>